/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ez2find.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;

/**
 *
 * @author Administrador
 */
@NamedQueries(value={@NamedQuery(name="listAllPosts", query="SELECT p FROM Post p" ),  
                     @NamedQuery(name="postingsUser", query="SELECT p FROM Post p WHERE p.user=:registerUser ORDER BY p.createDate DESC, p.id DESC"),
                     @NamedQuery(name="postingFound", query="SELECT p FROM Post p WHERE p.site=:site AND p.type=:type AND p.id=:id AND p.status='active'")})
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Post implements Serializable{

    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE)
    private long id;
    private String type;
    private long code;
    private String title;
    private String email;
    private String typeReplyTo;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date createDate;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date publishDate;
    private String description;
    private String status;
    private String categorie;
    private String fee;
    private int miscategorized;
    private int prohibited;
    private int spam;
    private int best;
    @ManyToOne()
    private Site site;
    @ManyToOne()
    private Area area;
    private String location;
    @ManyToOne()
    private RegisterUser user;
    
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Site getSite() {
        return site;
    }

    public void setSite(Site site) {
        this.site = site;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public RegisterUser getUser() {
        return user;
    }

    public void setUser(RegisterUser user) {
        this.user = user;
    }

    public Area getArea() {
        return area;
    }

    public void setArea(Area area) {
        this.area = area;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public long getCode() {
        return code;
    }

    public void setCode(long code) {
        this.code = code;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getCategorie() {
        return categorie;
    }

    public void setCategorie(String categorie) {
        this.categorie = categorie;
    }

    public String getFee() {
        return fee;
    }

    public void setFee(String fee) {
        this.fee = fee;
    }

    public String getTypeReplyTo() {
        return typeReplyTo;
    }

    public void setTypeReplyTo(String typeReplyTo) {
        this.typeReplyTo = typeReplyTo;
    }

    public int getMiscategorized() {
        return miscategorized;
    }

    public void setMiscategorized(int miscategorized) {
        this.miscategorized = miscategorized;
    }

    public int getProhibited() {
        return prohibited;
    }

    public void setProhibited(int prohibited) {
        this.prohibited = prohibited;
    }

    public int getSpam() {
        return spam;
    }

    public void setSpam(int spam) {
        this.spam = spam;
    }

    public int getBest() {
        return best;
    }

    public void setBest(int best) {
        this.best = best;
    }

}
